home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9358 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: maverick.tad.eds.com!news-admin@tad.eds.com
  2. From: Perry Hoekstra <lnusmsc.phoeks01@eds.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: unsigned char question
  5. Date: Thu, 29 Feb 1996 23:08:27 -0600
  6. Organization: EDS
  7. Message-ID: <3136864B.7154@eds.com>
  8. NNTP-Posting-Host: 206.120.14.44
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (Win95; I)
  13.  
  14. This is a basic question but one I cannot answer.  I am using VC++ 2.0
  15. and I wish to assign a string to a variable of type UCHAR * (which is an unsigned char 
  16. within ODBC).  The code is as follows
  17.  
  18. UCHAR * server;
  19.  
  20. server = "jmbademo";
  21.  
  22. When I attempt to compile this piece of code, I receive the following error:
  23.  
  24. C:\cgi\Envvars\Envvar.cpp(417) : error C2446: '=' : no conversion from 'char[9]' to 
  25. 'unsigned char*'
  26.  
  27. In addition, when I try to copy or concatenate with lstrcpy or lstrcat, I receive the 
  28. following error:
  29.  
  30. C:\cgi\Envvars\Envvar.cpp(432) : error C2664: 'lstrcpyA' : cannot convert parameter 1 from 
  31. 'unsigned char*' to 'char*'
  32.  
  33. C:\cgi\Envvars\Envvar.cpp(433) : error C2664: 'lstrcatA' : cannot convert parameter 1 from 
  34. 'unsigned char*' to 'char*'
  35.  
  36. I am taking these code examples straight from Microsoft's examples for ODBC calls in their 
  37. MSDN CD-ROM (i.e. Static SQL Example).  What am I doing wrong or how would you code a 
  38. SQLConnect call within VC++ 2.0?
  39.  
  40. Thank you
  41.  
  42. Perry Hoekstra
  43. lnusmsc.phoeks01@eds.com
  44.